.\" -*- nroff -*-
.\" Copyright 2013 Los Alamos National Security, LLC. All rights reserved.
.\" Copyright 2010 Cisco Systems, Inc.  All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" Copyright (c) 2020      Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Type_size 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Type_size\fP, \fBMPI_Type_size_x\fP \- Returns the number of bytes occupied by entries in a data type.

.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Type_size(MPI_Datatype \fIdatatype\fP, int\fI *size\fP)
int MPI_Type_size_x(MPI_Datatype \fIdatatype\fP, MPI_Count\fI *size\fP)

.fi
.SH Fortran Syntax
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_SIZE(\fIDATATYPE, SIZE, IERROR\fP)
	INTEGER	\fIDATATYPE, SIZE, IERROR\fP
MPI_TYPE_SIZE_X(\fIDATATYPE, SIZE, IERROR\fP)
	INTEGER	\fIDATATYPE\fP
        INTEGER(KIND=MPI_COUNT_KIND) \fISIZE\fP
        INTEGER \fIIERROR\fP

.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Type_size(\fIdatatype\fP, \fIsize\fP, \fIierror\fP)
	TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP
	INTEGER, INTENT(OUT) :: \fIsize\fP
	INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP
MPI_Type_size_x(\fIdatatype\fP, \fIsize\fP, \fIierror\fP)
	TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP
	INTEGER(KIND=MPI_COUNT_KIND), INTENT(OUT) :: \fIsize\fP
	INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP

.fi
.SH INPUT PARAMETER
.ft R
.TP 1i
datatype
Datatype (handle).
.sp

.SH OUTPUT PARAMETERS
.ft R
.TP 1i
size
Datatype size (integer).
.sp
.ft R
.TP 1i
IERROR
Fortran only: Error status (integer).

.SH DESCRIPTION
.ft R
MPI_Type_size returns the total size, in bytes, of the entries in the type signature associated with datatype; i.e., the total size of the data in a message that would be created with this datatype. Entries that occur multiple times in the datatype are counted with their multiplicity. For either function, if the \fIsize\fP parameter cannot express the value to be returned (e.g., if the parameter is too small to hold the output value), it is set to MPI_UNDEFINED.

.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for the \fISIZE\fP argument of MPI_Type_size_x only for Fortran 90. FORTRAN 77 users may use the non-portable syntax
.sp
.nf
     INTEGER*MPI_COUNT_KIND \fISIZE\fP
.fi
.sp
where MPI_COUNT_KIND is a constant defined in mpif.h and gives the length of the declared integer in bytes.

